package network;/*
 *@ 代阳敲的专属代码
 **/

import java.io.IOException;
import java.net.SocketException;
import java.util.HashMap;
import java.util.Map;

public class UdpDictServer extends UdpEchoServer{
    private Map<String,String> dict =new HashMap<>();
    public UdpDictServer(int port) throws SocketException {
        super(port);
        dict.put("cat", "⼩猫");
        dict.put("dog", "⼩狗");
        dict.put("fuck", "卧槽");
    }
    @Override
    public  String process(String request) {
        return dict.getOrDefault(request,"该词没有查询到");
    }

    public static void main(String[] args) throws IOException {
        UdpDictServer server=new UdpDictServer(9090);
        server.start();
    }
}
